<template>
    <div class="chaxun">
        <div class="cx-select">
            <div style="flex:1;padding:0 1rem 1rem 1rem">
                <el-select placeholder="片区" v-model="dicValues" @change="getList()" style="width:100%">
                    <el-option label="全部" value=""></el-option>
                    <el-option v-for="item in areaList" :key="item.value" :label="item.name" :value="item.value">
                    </el-option>
                </el-select>
            </div>
        </div>
        <div>
            <div class="numlist" v-for="item in list" :key="item.value" @click="toIndex(item.id,item.type)">
                <div style="flex:0 0 95%">
                    <b>
                        {{item.name}}
                    </b>
                </div>
                <div style="flex:0 0 5%">
                    <i class="iconfont icon-jiantou-copy" style="color:#409eff;"></i>
                </div>
                <div class="flex">
                    设备数量：{{item.equipTotal}}
                </div>
            </div>
        </div>
        <!-- <button @click="$router.push('details')">详情</button> -->
    </div>
</template>

<script>
import utils from '@/utils'
import {
    getUserInfo,
    setUserInfo,
    logout
} from '@/utils/auth'
export default {
    data() {
        return {
            areaList: [
                { value: 'S01', name: '水源地' },
                { value: 'S02', name: '自来水厂' },
                { value: 'S03', name: '供水泵站' },
                { value: 'S04，S05,S06', name: '供水管网' },
                { value: 'S07', name: '供水大户' },
                { value: 'S08', name: '用户' },
                { value: 'S09', name: '消防栓' },
                { value: 'S10', name: '供水视频监控' },
                { value: 'W01', name: '污水厂' },
                { value: 'W02', name: '农村污水处理点' },
                { value: 'W03', name: '污水视频监控' },
                { value: 'P01', name: '排水泵站' },
                { value: 'P02，P03', name: '排水管网' },
                { value: 'P04', name: '窖井水位监测' },
                { value: 'P05', name: '排水大户' },
                { value: 'P06', name: '排水视频监控' }
            ],
            dicValues: '',
            list: [],
        }
    },
    created() {
        setUserInfo(utils.getQueryString('token'))
        // console.log(utils.getQueryString('token'))
        console.log(utils.getQueryString('frid'))
    },
    mounted() {
        this.getList()
    },
    methods: {
        toIndex(id, type) {
            this.$router.push({ path: 'index', query: { id: id, type: type } })
        },
        //获取列表
        getList() {
            this.$api.chaxun.selSiteAndEquipList({
                dicValues: this.dicValues
            }).then(res => {
                if (res.success) {
                    this.list = res.data
                }
            });

        },
    }
}
</script>

<style>
</style>
